package LeetCode;

public class Offer_16 {
    public static void main(String[] args) {
        System.out.println(myPow(0.00001
                ,2147483647));
    }
    public static double r=1;
    public static double myPow(double x, int n) {
        double res=1;
        boolean flag=true;
        if(n<0){
            n=0-n;
            flag=false;
        }
         r=1;
        res=a(x,n);
        if(!flag){
            return 1/res;
        }
        return res;
    }

    public static double a(double x,int n){
        if(n==0){
            return r;
        }
        r=r*x;
        return a(x,n-1);
    }
}
